using System;
using System.IO;
using System.Collections.Generic;
using System.Xml;

namespace atomtask
{
	public partial class GlobalData
	{
		/* This class provides XML processing for the whole application */
		public class XMLHandler
		{
			private XmlDocument doc;
			private XmlTextReader reader;

			public bool loadXML(string input)
			{
				// Check if the input is a well-formed xml
				doc = new XmlDocument();
				try
				{
					doc.LoadXml (input);
					reader = new XmlTextReader (new System.IO.StringReader(input));
					reader.MoveToContent();
					reader.Read();
					return true;
				}
				catch (System.Xml.XmlException)
				{
					return false;
				}
			}

			public string readContent()
			{
				reader.Read();
				return reader.ReadInnerXml();
			}

			public string readNextElement()
			{
				return reader.ReadInnerXml();
			}
		}
	}
}

